Skip to content

fix(create-blocks-app): include Amplify dev server template#242

Open
ikenyal wants to merge 1 commit into
aws-devtools-labs:mainfrom
ikenyal:fix/amplify-dev-server-template
Open

fix(create-blocks-app): include Amplify dev server template#242
ikenyal wants to merge 1 commit into
aws-devtools-labs:mainfrom
ikenyal:fix/amplify-dev-server-template

Conversation

@ikenyal

@ikenyal ikenyal commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Problem

Issue #, if available: Fixes #241

When AWS Blocks is added to an Amplify Gen 2 project, the CLI adds blocks:dev with tsx watch aws-blocks/scripts/server.ts. The Amplify overlay did not include that file, so the documented command immediately failed with ERR_MODULE_NOT_FOUND.

This is present in the published @aws-blocks/create-blocks-app package as well as in the repository source.

Changes

  • Add the missing Amplify aws-blocks/scripts/server.ts template, using the existing backend-template local server pattern on port 3001.
  • Extend the Amplify auto-detection test to verify that the generated blocks:dev script has a matching server file.
  • Add a patch changeset for @aws-blocks/create-blocks-app.

Validation

  • Added a regression assertion that failed before the template was added and passes after the fix.
  • npm run build
  • npm run lint:deps
  • npm test
  • npm run test:e2e:local (comprehensive: 372 passed, 0 failed, 1 skipped; vendorize: 8 passed, 0 failed)
  • npm pack --dry-run --workspace @aws-blocks/create-blocks-app confirms the new template is included.
  • npx changeset status

Checklist

  • PR description included
  • Tests are changed or added
  • Relevant documentation is changed or added (not applicable: this restores the already-generated blocks:dev command; it adds no new user-facing workflow or API documentation.)

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@ikenyal
ikenyal requested a review from a team as a code owner July 20, 2026 21:09
@changeset-bot

changeset-bot Bot commented Jul 20, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: d0bb476

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@aws-blocks/create-blocks-app Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@sarayev sarayev left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this — the added server.ts correctly resolves the npm run blocks:dev / ERR_MODULE_NOT_FOUND failure, and the regression test is a nice touch.

One thing to flag before this closes #241: the issue reports two separate failures, and this PR only addresses the first. The second — npm run blocks:generate-client failing with Cannot find package '@aws-blocks/core' — is still present, because the Amplify template imports @aws-blocks/core directly even though only @aws-blocks/blocks is declared as a dependency.

The cleanest fix is to import through the public @aws-blocks/blocks package instead of the internal @aws-blocks/core, in both files:

  • aws-blocks/scripts/generate-client.tsimport { generateClientCode } from '@aws-blocks/blocks/scripts'
  • aws-blocks/cognito-verifier.tsimport { ApiError, type BlocksContext } from '@aws-blocks/blocks'

(Note it needs both — fixing only generate-client.ts will just surface the same error from cognito-verifier.ts next.) Since Fixes #241 would auto-close the issue, could we either fold this in here, or switch to Partially addresses #241 and track it separately?

@sarayev sarayev left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this — the added server.ts correctly resolves the npm run blocks:dev / ERR_MODULE_NOT_FOUND failure, and the regression test is a nice touch.

One thing to flag before this closes #241: the issue reports two separate failures, and this PR only addresses the first. The second — npm run blocks:generate-client failing with Cannot find package '@aws-blocks/core' — is still present, because the Amplify template imports @aws-blocks/core directly even though only @aws-blocks/blocks is declared as a dependency.

The cleanest fix is to import through the public @aws-blocks/blocks package instead of the internal @aws-blocks/core, in both files:

  • aws-blocks/scripts/generate-client.tsimport { generateClientCode } from '@aws-blocks/blocks/scripts'
  • aws-blocks/cognito-verifier.tsimport { ApiError, type BlocksContext } from '@aws-blocks/blocks'

(Note it needs both — fixing only generate-client.ts will just surface the same error from cognito-verifier.ts next.) Since Fixes #241 would auto-close the issue, could we either fold this in here, or switch to Partially addresses #241 and track it separately?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Multiple ERR_MODULE_NOT_FOUND when following Flutter + Amplify + AWS Blocks quickstart step by step

2 participants